#define _CRT_SECURE_NO_WARNINGS  1


#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;

int main()
{
    int a;
    cin >> a;
    vector<int> v;
    int count = 0;
    int m = 0;
    while (a != 0)
    {
        v.push_back(a % 2);
        a /= 2;
    }
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] == 1)
        {
            count++;
            m = max(count, m);
        }
        else
            count = 0;
    }
    cout << m << endl;
    return 0;
}